package com.ruoyi.system.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.GaPropagandaModfiyRecord;
import com.ruoyi.system.service.IGaPropagandaModfiyRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 宣传信息修改记录Controller
 * 
 * @author wzp
 * @date 2021-11-26
 */
@RestController
@RequestMapping("/kyga/propagandaModfiyRecord")
public class GaPropagandaModfiyRecordController extends BaseController
{
    @Autowired
    private IGaPropagandaModfiyRecordService gaPropagandaModfiyRecordService;

    /**
     * 查询宣传信息修改记录列表
     */
    @PreAuthorize("@ss.hasPermi('kyga:propagandaModfiyRecord:list')")
    @GetMapping("/list")
    public TableDataInfo list(GaPropagandaModfiyRecord gaPropagandaModfiyRecord)
    {
        startPage();
        List<GaPropagandaModfiyRecord> list = gaPropagandaModfiyRecordService.selectGaPropagandaModfiyRecordList(gaPropagandaModfiyRecord);
        return getDataTable(list);
    }

    /**
     * 导出宣传信息修改记录列表
     */
    @PreAuthorize("@ss.hasPermi('kyga:propagandaModfiyRecord:export')")
    @Log(title = "宣传信息修改记录", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(GaPropagandaModfiyRecord gaPropagandaModfiyRecord)
    {
        List<GaPropagandaModfiyRecord> list = gaPropagandaModfiyRecordService.selectGaPropagandaModfiyRecordList(gaPropagandaModfiyRecord);
        ExcelUtil<GaPropagandaModfiyRecord> util = new ExcelUtil<GaPropagandaModfiyRecord>(GaPropagandaModfiyRecord.class);
        return util.exportExcel(list, "宣传信息修改记录数据");
    }

    /**
     * 获取宣传信息修改记录详细信息
     */
    @PreAuthorize("@ss.hasPermi('kyga:propagandaModfiyRecord:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(gaPropagandaModfiyRecordService.selectGaPropagandaModfiyRecordById(id));
    }

    /**
     * 新增宣传信息修改记录
     */
    @PreAuthorize("@ss.hasPermi('kyga:propagandaModfiyRecord:add')")
    @Log(title = "宣传信息修改记录", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GaPropagandaModfiyRecord gaPropagandaModfiyRecord)
    {
        return toAjax(gaPropagandaModfiyRecordService.insertGaPropagandaModfiyRecord(gaPropagandaModfiyRecord));
    }

    /**
     * 修改宣传信息修改记录
     */
    @PreAuthorize("@ss.hasPermi('kyga:propagandaModfiyRecord:edit')")
    @Log(title = "宣传信息修改记录", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GaPropagandaModfiyRecord gaPropagandaModfiyRecord)
    {
        return toAjax(gaPropagandaModfiyRecordService.updateGaPropagandaModfiyRecord(gaPropagandaModfiyRecord));
    }

    /**
     * 删除宣传信息修改记录
     */
    @PreAuthorize("@ss.hasPermi('kyga:propagandaModfiyRecord:remove')")
    @Log(title = "宣传信息修改记录", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(gaPropagandaModfiyRecordService.deleteGaPropagandaModfiyRecordByIds(ids));
    }
}
